/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.brucexx.assistx.faq;

import com.brucexx.assistx.common.db.jdbc.JdbcManager;
import com.brucexx.assistx.util.StringUtil;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;

/**
 *
 * @author zhao.xiong
 */
public class BaseController {

    protected static Logger logger = Logger.getLogger(BaseController.class);

    public JdbcManager getMode(HttpServletRequest req) {
        String mode = StringUtil.null2String(req.getParameter("mode"));
        if (StringUtils.equalsIgnoreCase("1", mode)) {
            return sgwDevDB;
        }
        if (StringUtils.equalsIgnoreCase("2", mode)) {
            return sgwSitDB;
        }
        return sgwDevDB;
    }
    private JdbcManager sgwSitDB;
    private JdbcManager sgwDevDB;

    /**
     * @param sgwSitDB the sgwSitDB to set
     */
    public void setSgwSitDB(JdbcManager sgwSitDB) {
        this.sgwSitDB = sgwSitDB;
    }

    /**
     * @param sgwDevDB the sgwDevDB to set
     */
    public void setSgwDevDB(JdbcManager sgwDevDB) {
        this.sgwDevDB = sgwDevDB;
    }
}
